package com.yss.sofa.report.engine.cell.visible.extendable;

import java.util.HashMap;
import java.util.Map;

import com.yss.sofa.report.engine.Const;
import com.yss.sofa.report.engine.cell.ReportCell;
import com.yss.sofa.report.engine.cell.visible.VisibleCell;

public class ExtendableCell extends VisibleCell{
	private static final long serialVersionUID = 1685640434914843146L;
	protected int extend;
	protected int skip;
	protected boolean autoMerge;
	protected String forceMerge;
	protected String dataset;
	protected String field;
	protected Map<String,String> record=new HashMap<String, String>();
	protected String style;
	protected String html;
	protected Map<String,String> attr=new HashMap<String, String>();
	protected void init(){
		super.init();
		this.extend=Const.CELL_EXTEND_NONE;
		this.autoMerge=false;
		this.forceMerge="";
		this.dataset=Const.NONE;
		this.field=Const.NONE;
		this.html="";
		this.style="";
		this.skip=0;
	}
	public void assignTo(ReportCell cell){
		ExtendableCell _=(ExtendableCell)cell;
		super.assignTo(_);
		_.extend=this.extend;
		_.autoMerge=this.autoMerge;
		_.forceMerge=this.forceMerge;
		_.dataset=this.dataset;
		_.field=this.field;
		_.record.clear();
		_.record.putAll(this.record);
		_.html=this.html;
		_.style=this.style;
		_.skip=this.skip;
		_.attr.clear();
		_.attr.putAll(this.attr);
	}
	public ExtendableCell create(){
		ExtendableCell _=new ExtendableCell();
		this.assignTo(_);
		return _;
	}
	public int getExtend() {
		return extend;
	}
	public void setExtend(int extend) {
		this.extend = extend;
	}
	public boolean isAutoMerge() {
		return autoMerge;
	}
	public void setAutoMerge(boolean autoMerge) {
		this.autoMerge = autoMerge;
	}
	public String getDataset() {
		return dataset;
	}
	public void setDataset(String dataset) {
		this.dataset = dataset;
	}
	public String getField() {
		return field;
	}
	public void setField(String field) {
		this.field = field;
	}
	public String getForceMerge() {
		return forceMerge;
	}
	public void setForceMerge(String forceMerge) {
		this.forceMerge = forceMerge;
	}
	public String getHtml() {
		return html;
	}
	public void setHtml(String html) {
		this.html = html;
	}
	public String getStyle() {
		return style;
	}
	public void setStyle(String style) {
		this.style = style;
	}
	public Map<String, String> getRecord() {
		return record;
	}
	public Map<String, String> getAttr() {
		return attr;
	}
	public void setAttr(Map<String, String> attr) {
		this.attr = attr;
	}
	public int getSkip() {
		return skip;
	}
	public void setSkip(int skip) {
		if(skip<0){
			skip=0;
		}
		this.skip = skip;
	}
}
